package sraft

import (
	"github.com/sdttttt/sraft/config"
)

// RaftKernel is to Coordinate the work between the modules
type RaftKernel struct {
	Conf *config.RaftKernelConfig

	Name string

	// Log item
	log []*Log

	// commited log item index
	commitIndex int

	// 最后一个被应用到状态机的条目
	lastApplied int

	// Raft matchine
	matchine StateSlot
}

// NewRaftNode is to quick get a RaftNode instance.
func NewRaftNode(name string, status RaftNodeState, conf *config.RaftKernelConfig) *RaftKernel {

	return &RaftKernel{
		Conf:        conf,
		Name:        name,
		matchine:    NewMatchine(status),
		log:         make([]*Log, 0),
		commitIndex: -1,
		lastApplied: -1,
	}
}

// Runner is to RaftNode to work.
func (rf *RaftKernel) Runner() {

}
